home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gchess40.lha / gnuchess4.0p62 / misc / ChessFont next >
Text File  |  1991-10-08  |  28KB  |  781 lines

  1. %!PS-Adobe-1.0
  2. %% This is my font for chess and similar pieces.  It is supplied "as is".
  3. %% It works for me, I have no idea whether it will work for you;  you gets
  4. %% what you pays for.  Before using it, you should read the Copyright
  5. %% notice below and the "README" file which should accompany this file.
  6. %%    -- ANW, March 1991.
  7.  
  8. /Cfont 9 dict dup begin
  9.  
  10. /FontMatrix [ 0.001 0 0 0.001 0 0 ] readonly def
  11. /FontType 3 def
  12. /FontBBox [ 0 0 0 0 ] readonly def
  13. /Encoding 256 array def
  14. /FontInfo 3 dict dup begin
  15.   /Notice (
  16.  
  17.     Copyright (c) 1991 A. N. Walker.  All rights reserved.
  18.  
  19.     This notice must be preserved in all versions of this file, and
  20.     any alterations which you make must be clearly marked as such.
  21.     For further information, see the "README" file which should
  22.     accompany this, or contact me at Dept of Mathematics, Nottingham
  23.     Univ., UK, anw@maths.nott.ac.uk.
  24.  
  25.      ) readonly def
  26.   /FullName (ChessFont) readonly def
  27.   /version (2.0) readonly def
  28. end def
  29. /UniqueID 472474 def
  30.  
  31. Encoding
  32. 0 1 255 { 2 copy /.notdef put pop } for
  33. dup 8#040 /Wsquare put        % ' '
  34. dup 8#042 /flap put        % '"'
  35. dup 8#043 /board put        % '#'
  36. dup 8#047 /flip put        % ''''
  37. dup 8#052 /Bsquare put        % '*'
  38. dup 8#055 /edge put        % '-'
  39. dup 8#056 /blobfig put        % '.'
  40. dup 8#057 /corner put        % '/'
  41. dup 8#060 /m0 put        % '0'
  42. dup 8#061 /Wsquare put        % '1'
  43. dup 8#062 /m2 put        % '2'
  44. dup 8#063 /m3 put        % '3'
  45. dup 8#064 /m4 put        % '4'
  46. dup 8#065 /m5 put        % '5'
  47. dup 8#066 /m6 put        % '6'
  48. dup 8#067 /m7 put        % '7'
  49. dup 8#070 /m8 put        % '8'
  50. dup 8#071 /m9 put        % '9'
  51. dup 8#073 /nextline put        % ';'
  52. dup 8#074 /m-1 put        % '<'
  53. dup 8#076 /Wsquare put        % '>'
  54. dup 8#100 /wblock put        % '@'
  55. dup 8#102 /WB put        % 'B'
  56. dup 8#103 /WC put        % 'C'
  57. dup 8#104 /WD put        % 'D'
  58. dup 8#105 /WE put        % 'E'
  59. dup 8#106 /WF put        % 'F'
  60. dup 8#107 /WG put        % 'G'
  61. dup 8#111 /blob put        % 'I'
  62. dup 8#113 /WK put        % 'K'
  63. dup 8#114 /WL put        % 'L'
  64. dup 8#115 /WM put        % 'M'
  65. dup 8#116 /WN put        % 'N'
  66. dup 8#117 /BO put        % 'O'
  67. dup 8#120 /WP put        % 'P'
  68. dup 8#121 /WQ put        % 'Q'
  69. dup 8#122 /WR put        % 'R'
  70. dup 8#123 /WS put        % 'S'
  71. dup 8#124 /WT put        % 'T'
  72. dup 8#125 /WU put        % 'U'
  73. dup 8#126 /WV put        % 'V'
  74. dup 8#130 /WX put        % 'X'
  75. dup 8#132 /WZ put        % 'Z'
  76. dup 8#133 /posstart put        % '['
  77. dup 8#135 /posfinish put    % ']'
  78. dup 8#137 /underbar put        % '_'
  79. dup 8#142 /BB put        % 'b'
  80. dup 8#143 /BC put        % 'c'
  81. dup 8#144 /BD put        % 'd'
  82. dup 8#145 /BE put        % 'e'
  83. dup 8#146 /BF put        % 'f'
  84. dup 8#147 /BG put        % 'g'
  85. dup 8#151 /blob put        % 'i'
  86. dup 8#153 /BK put        % 'k'
  87. dup 8#154 /BL put        % 'l'
  88. dup 8#155 /BM put        % 'm'
  89. dup 8#156 /BN put        % 'n'
  90. dup 8#157 /BO put        % 'o'
  91. dup 8#160 /BP put        % 'p'
  92. dup 8#161 /BQ put        % 'q'
  93. dup 8#162 /BR put        % 'r'
  94. dup 8#163 /BS put        % 's'
  95. dup 8#164 /BT put        % 't'
  96. dup 8#165 /BU put        % 'u'
  97. dup 8#166 /BV put        % 'v'
  98. dup 8#170 /BX put        % 'x'
  99. dup 8#172 /BZ put        % 'z'
  100. dup 8#174 /sidebar put        % '|'
  101. dup 8#240 /Wsquare put        % ' '+
  102. dup 8#241 /without put        % '!'+
  103. dup 8#242 /flap put        % '"'+
  104. dup 8#243 /board put        % '#'+
  105. dup 8#245 /infinityequals put    % '%'+
  106. dup 8#247 /flip put        % ''''+
  107. dup 8#252 /circledot put    % '*'+
  108. dup 8#253 /plus put        % '+'+
  109. dup 8#255 /minus put        % '-'+
  110. dup 8#272 /doubled put        % ':'+
  111. dup 8#273 /nextline put        % ';'+
  112. dup 8#274 /equalsplus put    % '<'+
  113. dup 8#275 /equal put        % '='+
  114. dup 8#276 /plusequals put    % '>'+
  115. dup 8#277 /infinity put        % '?'+
  116. dup 8#300 /circarrow put    % '@'+
  117. dup 8#302 /Bfig put        % 'B'+
  118. dup 8#303 /Cfig put        % 'C'+
  119. dup 8#304 /Dfig put        % 'D'+
  120. dup 8#305 /Efig put        % 'E'+
  121. dup 8#306 /Ffig put        % 'F'+
  122. dup 8#307 /Gfig put        % 'G'+
  123. dup 8#311 /blobfig put        % 'I'+
  124. dup 8#313 /Kfig put        % 'K'+
  125. dup 8#314 /Lfig put        % 'L'+
  126. dup 8#315 /Mfig put        % 'M'+
  127. dup 8#316 /Nfig put        % 'N'+
  128. dup 8#317 /Ofig put        % 'O'+
  129. dup 8#320 /Pfig put        % 'P'+
  130. dup 8#321 /Qfig put        % 'Q'+
  131. dup 8#322 /Rfig put        % 'R'+
  132. dup 8#323 /Sfig put        % 'S'+
  133. dup 8#324 /Tfig put        % 'T'+
  134. dup 8#325 /Ufig put        % 'U'+
  135. dup 8#326 /Vfig put        % 'V'+
  136. dup 8#330 /Xfig put        % 'X'+
  137. dup 8#332 /Zfig put        % 'Z'+
  138. dup 8#333 /minusorplus put    % '['+
  139. dup 8#335 /plusorminus put    % ']'+
  140. dup 8#336 /uparrow put        % '^'+
  141. dup 8#341 /rightarrow put    % 'a'+
  142. dup 8#342 /semicircle put    % 'b'+
  143. dup 8#343 /centre put        % 'c'+
  144. dup 8#344 /diags put        % 'd'+
  145. dup 8#345 /etc put        % 'e'+
  146. dup 8#346 /Phalo put        % 'f'+
  147. dup 8#347 /samebs put        % 'g'+
  148. dup 8#350 /edgefig put        % 'h'+
  149. dup 8#351 /triangle put        % 'i'+
  150. dup 8#352 /Bsquarefig put    % 'j'+
  151. dup 8#353 /kside put        % 'k'+
  152. dup 8#354 /line put        % 'l'+
  153. dup 8#355 /hash put        % 'm'+
  154. dup 8#356 /cornerfig put    % 'n'+
  155. dup 8#357 /square put        % 'o'+
  156. dup 8#360 /ending put        % 'p'+
  157. dup 8#361 /qside put        % 'q'+
  158. dup 8#362 /Pfill put        % 'r'+
  159. dup 8#363 /separated put    % 's'+
  160. dup 8#364 /tempo put        % 't'+
  161. dup 8#365 /united put        % 'u'+
  162. dup 8#366 /oppbs put        % 'v'+
  163. dup 8#367 /with put        % 'w'+
  164. dup 8#370 /weakpt put        % 'x'+
  165. dup 8#371 /bpair put        % 'y'+
  166. dup 8#372 /circlebolddot put    % 'z'+
  167.     8#374 /botharrow put    % '|'+
  168.  
  169. /CharProcs 200 dict dup begin
  170.  
  171. % Miscellaneous:
  172.     /.notdef { } bind def
  173.     /Arcto  { arcto 4 { pop } repeat } bind def
  174.     /Ddn3c  { dup dup neg 3 copy } bind def
  175.     /Round  { dtransform round exch round exch idtransform } bind def
  176.     /Rlineto { Round rlineto } bind def
  177.     /Rmoveto { Round rmoveto } bind def
  178.     /diamond { moveto dup neg 0 rmoveto dup dup neg rlineto
  179.         dup dup rlineto dup neg exch rlineto closepath } bind def
  180.     /dohalo { gsave 100 setlinewidth setW stroke grestore } bind def
  181.     /dofill { gsave fill grestore } bind def
  182.     /motion { 1000 mul exch 1000 mul exch setcharwidth } bind def
  183.     /setW    { 1 setgray } bind def
  184.     /setB    { 0 setgray } bind def
  185.     /drawingB { 0 currentgray eq } bind def
  186.     /setfig { 1000 0 0 -200 1000 800 setcachedevice 500 300 translate
  187.         } bind def
  188.     /setpce { 1000 0 setcharwidth 500 dup translate 0.95 dup scale
  189.         } bind def
  190.     /MiscStr (a) def
  191.     /tofig  { 0 get 8#200 add MiscStr exch 0 exch put MiscStr } bind def
  192.     /Tofig  { 1 0.95 div dup scale tofig } bind def
  193.     /intext true def
  194.     /flip    { 0 0 setcharwidth /intext intext not def } bind def
  195.     /flap    { 0 0 setcharwidth /intext true def } bind def
  196.     /Setfont { /ChessFont findfont 1000 scalefont setfont } bind def
  197.     /Show    { rotate -500 dup moveto Setfont show } bind def
  198.     /Showfig { rotate -500 -300 moveto Setfont show } bind def
  199.     /LocStr (a) def
  200.     /SetChar {
  201.         dup 8#047 eq { pop flip stop } if
  202.         dup 8#200 lt { intext {
  203.             8#200 add LocStr exch 0 exch put
  204.             Setfont LocStr dup stringwidth setcharwidth
  205.             0 0 moveto show stop } if } if } bind def
  206.     /DoChar { Encoding exch get cvx exec } bind def
  207.  
  208. % Kings
  209.     /WK {    setpce Kout dohalo setW dofill setB stroke Kin } bind def
  210.     /BK {    setpce Kout dohalo dofill stroke setW Kin } bind def
  211.     /Kfig { setfig Kout stroke Kin } bind def
  212.  
  213.     /Kout {    2 setmiterlimit
  214.         325 -100 moveto 600 100 350 400 125 250 curveto
  215.         0 250 rlineto -250 0 rlineto 0 -250 rlineto
  216.         -350 400 -600 100 -325 -100 curveto 0 -250 rlineto
  217.         -100 -500 100 -500 325 -350 curveto closepath
  218.         30 setlinewidth } bind def
  219.     /Kin {    drawingB { 325 } { 275 } ifelse
  220.         Ddn3c -350 moveto 0 -300 3 -1 roll -350 800 Arcto
  221.         -350 lineto -100 moveto 0 -50 3 -1 roll
  222.         -100 800 Arcto -100 lineto
  223.         15 0 -185 diamond 15 -250 -210 diamond 15 250 -210 diamond
  224.         drawingB { 125 } { 75 } ifelse
  225.         Ddn3c dup dup 4 { 0 375 moveto rlineto } repeat
  226.         drawingB { 0 -45 moveto 125 250 lineto -250 0 rlineto
  227.             closepath } { 15 0 180 diamond 265 -95 moveto
  228.             480 150 280 380 50 -50 curveto -265 -95 moveto
  229.             -480 150 -280 380 -50 -50 curveto } ifelse
  230.         stroke } bind def
  231.  
  232. % Queens
  233.     /WQ {    setpce Qout dohalo setW dofill setB stroke Qin } bind def
  234.     /BQ {    setpce Qout dohalo dofill stroke setW Qin } bind def
  235.     /Qfig { setfig Qout stroke Qin } bind def
  236.  
  237.     /Qout {    2 setmiterlimit
  238.         0 75 moveto -150 440 50 -80 280 arc -250 25 lineto
  239.         -440 200 50 -60 300 arc -325 -100 lineto 0 -250 rlineto
  240.         -100 -500 100 -500 325 -350 curveto 0 250 rlineto
  241.         440 200 50 -120 240 arc 250 25 lineto 150 440 50 -100 260 arc
  242.         closepath 30 setlinewidth } bind def
  243.     /Qin {    drawingB { 325 } { 275 } ifelse
  244.         Ddn3c -350 moveto 0 -300 3 -1 roll -350 800 Arcto -350 lineto
  245.         -100 moveto 0 -50 3 -1 roll -100 800 Arcto -100 lineto
  246.         15 0 -185 diamond 15 -250 -210 diamond 15 250 -210 diamond
  247.         stroke } bind def
  248.  
  249. % Rooks
  250.     /WR {    setpce Rout dohalo setW dofill setB stroke Rin } bind def
  251.     /BR {    setpce Rout dohalo dofill stroke setW Rin } bind def
  252.     /Rfig { setfig Rout stroke Rin } bind def
  253.  
  254.     /Rout { -325 -450 moveto 650 0 rlineto 0 50 rlineto -100 175 rlineto
  255.         0 400 rlineto 50 75 rlineto 0 150 rlineto -86 0 rlineto
  256.         -30 -100 rlineto -86 0 rlineto -30 100 rlineto -86 0 rlineto
  257.         -30 -100 rlineto -86 0 rlineto -30 100 rlineto -86 0 rlineto
  258.         0 -150 rlineto 50 -75 rlineto 0 -400 rlineto -100 -175 rlineto
  259.         closepath 30 setlinewidth } bind def
  260.     /Rin {    drawingB { -225 } { -195 } ifelse
  261.         dup -225 moveto dup -2 mul 0 rlineto
  262.         dup 175 moveto -2 mul 0 rlineto stroke } bind def
  263.  
  264. % Bishops
  265.     /WB {    Bsetpce Bout setW dofill setB stroke Bin } bind def
  266.     /BB {    Bsetpce Bout dofill stroke setW Bin } bind def
  267.     /Bfig { Bsetfig Bout stroke Bin } bind def
  268.  
  269.     /Bsetpce { /Binpce true def setpce } bind def
  270.     /Bsetfig { /Binpce false def setfig } bind def
  271.     /Bout {    2 setmiterlimit
  272.         -400 -500 moveto 100 100 300 0 400 100 rcurveto
  273.         100 -100 300 0 400 -100 rcurveto 0 100 rlineto
  274.         -100 100 -300 0 -400 100 rcurveto
  275.         -100 -100 -300 0 -400 -100 rcurveto closepath
  276.         200 -350 moveto 0 200 rlineto
  277.         200 0 150 215 0 325 curveto -75 420 40 -90 270 arc
  278.         -340 100 -340 100 -200 -150 curveto 0 -200 rlineto
  279.         200 50 rlineto closepath 30 setlinewidth
  280.         gsave    0 325 moveto 150 215 200 0 200 -150 curveto
  281.             340 100 340 100 75 380 curveto 75 420 40 -90 270 arc
  282.             closepath Binpce { dohalo setW dofill setB } if stroke
  283.         grestore } bind def
  284.     /Bin {  15 0 -225 diamond
  285.         drawingB { 200 } { 150 } ifelse Ddn3c
  286.         -350 moveto 20 rlineto -20 rlineto -150 moveto
  287.         30 rlineto -30 rlineto stroke } bind def
  288.  
  289. % Knights
  290.     /WN {    setpce Nout dohalo setW dofill setB stroke Nin } bind def
  291.     /BN {    setpce Nout dohalo dofill stroke setW Nin } bind def
  292.     /Nfig { setfig Nout stroke Nin } bind def
  293.  
  294.     /Nout {    2 setmiterlimit
  295.         450 -450 moveto 450 200 150 350 -50 400 curveto
  296.         -25 100 rlineto -75 -200 rlineto -75 150 rlineto
  297.         0 -150 rlineto -125 -125 -325 -400 -275 -450 rcurveto
  298.         75 -75 rlineto 100 130 rlineto 0 -200 rlineto
  299.         50 -25 150 100 100 150 rcurveto 50 -50 150 75 125 150 rcurveto
  300.         125 -300 -250 -250 -250 -450 curveto
  301.         closepath 30 setlinewidth } bind def
  302.     /Nin {  15 -200 150 diamond stroke
  303.         drawingB {
  304.             [ 100 100 ] 0 setdash 410 -450 moveto
  305.             410 200 130 330 -60 380 curveto 50 setlinewidth
  306.             stroke } {
  307.             430 -430 moveto 430 200 150 350 -30 370 curveto
  308.             150 250 390 200 390 -430 curveto fill }
  309.         ifelse } bind def
  310.  
  311. % Pawns
  312.     % Pawns are the only symbols which occur "frequently" in a chess
  313.     % diagram, so we make a special effort to optimise their caching
  314.     % behaviour.  Also, they are the only symbols for which this is
  315.     % easy!
  316.  
  317.     /WP { setpce Setfont setW 0 0 moveto (f) tofig show setB (P) tofig
  318.         -500 -300 rmoveto show } bind def
  319.     /BP { setpce Setfont setW 0 0 moveto (f) tofig show setB (r) tofig
  320.         show } bind def
  321.     /Pfig { setfig Pout stroke Pin } bind def
  322.  
  323.     /Pout { 300 -450 moveto 200 -300  200 -300 75 -250 curveto
  324.         125 -50 125 -50 75 150 curveto 125 150 100 0 90 arc
  325.         0 300 100 -30 210 arc -125 150 100 90 180 arc
  326.         150 0 rlineto -125 -50 -125 -50 -75 -250 curveto
  327.         -200 -300 -200 -300 -300 -450 curveto
  328.         closepath 50 setlinewidth } bind def
  329.     /Pin { -75 150 moveto 150 0 rlineto stroke } bind def
  330.  
  331.     /Phalo { 0 0 -350 -500 350 450 setcachedevice
  332.         Pout gsave 100 setlinewidth stroke grestore fill } bind def
  333.     /Pfill { 0 0 -325 -475 375 425 setcachedevice
  334.         Pout gsave stroke grestore fill } bind def
  335.  
  336. % Fous
  337.     % There seem to be several styles of Fou (French Bishop) -- I have
  338.     % selected the easiest to implement.  Anyone who *really* wants
  339.     % this piece can do some work for themselves!
  340.  
  341.     /WF {    setpce Fout dohalo setW dofill setB stroke Fin } bind def
  342.     /BF {    setpce Fout dohalo dofill stroke setW Fin } bind def
  343.     /Ffig { setfig Fout stroke Fin } bind def
  344.  
  345.     /Fout { 2 setlinejoin
  346.         -300 -400 moveto 150 300 rlineto -250 500 rlineto
  347.         250 -125 rlineto 150 175 rlineto 150 -175 rlineto
  348.         250 125 rlineto -250 -500 rlineto 150 -300 rlineto
  349.         closepath 30 setlinewidth } bind def
  350.  
  351.     /Fin {  0 -400 150 dup mul 675 dup mul add sqrt
  352.         drawingB { 600 300 } { 30 sub 600 270 } ifelse
  353.         atan dup 180 sub neg arc
  354.         400 drawingB not { 15 5 sqrt mul add } if
  355.         dup neg 400 moveto dup dup -2 mul rlineto dup 2 mul rlineto
  356.         30 -100 150 diamond 30 100 150 diamond
  357.         0 175 moveto 0 -200 rlineto currentpoint stroke
  358.         75 210 330 arc stroke } bind def
  359.  
  360. % Miscellaneous Fairy pieces
  361.  
  362.     % Grasshopper
  363.     /WG {    setpce (Q) 180 Show } bind def
  364.     /BG {    setpce (q) 180 Show } bind def
  365.     /Gfig { setfig (Q) tofig 180 Showfig } bind def
  366.  
  367.     % Nightrider.  Real problemists use S for Knight and N for Nightrider;
  368.     %        the weight of tradition forces N for Knight, hence S here.
  369.     /WS {    setpce (N) 180 Show } bind def
  370.     /BS {    setpce (n) 180 Show } bind def
  371.     /Sfig { setfig (N) tofig 180 Showfig } bind def
  372.  
  373.     % Zebra
  374.     /WZ {    setpce (N) -90 Show } bind def
  375.     /BZ {    setpce (n) -90 Show } bind def
  376.     /Zfig { setfig (N) tofig -90 Showfig } bind def
  377.  
  378.     % Mao.  Also Camel, but C is for Chameleon.
  379.     /WM {    setpce (N) 90 Show } bind def
  380.     /BM {    setpce (n) 90 Show } bind def
  381.     /Mfig { setfig (N) tofig 90 Showfig } bind def
  382.  
  383.     % Vao
  384.     /WV {    setpce (B) 90 Show } bind def
  385.     /BV {    setpce (b) 90 Show } bind def
  386.     /Vfig { setfig (B) tofig 90 Showfig } bind def
  387.  
  388.     % Equihopper
  389.     /WE {    setpce (Q) -90 Show } bind def
  390.     /BE {    setpce (q) -90 Show } bind def
  391.     /Efig { setfig (Q) tofig -90 Showfig } bind def
  392.  
  393.     % Leo.  Also Locust, Lion, Edgehog
  394.     /WL {    setpce (Q) 90 Show } bind def
  395.     /BL {    setpce (q) 90 Show } bind def
  396.     /Lfig { setfig (Q) tofig 90 Showfig } bind def
  397.  
  398.     % Pao.  Also Empress.  Sorry, all Uther mnemonics seemed to be used Up.
  399.     /WU {    setpce (R) 90 Show } bind def
  400.     /BU {    setpce (r) 90 Show } bind def
  401.     /Ufig { setfig (R) tofig 90 Showfig } bind def
  402.  
  403.     % Orphan -- NB, all Orphans are black!
  404.     /BO {    setpce (p) 90 Show } bind def
  405.     /Ofig { setfig 90 rotate Pout dofill stroke } bind def
  406.  
  407.     % Rose.  Gardeners will know why T is mnemonic for this.
  408.     /WT {    setpce Tout dohalo setW dofill setB stroke Tin } bind def
  409.     /BT {    setpce Tout dohalo dofill stroke setW Tin } bind def
  410.     /Tfig { setfig Tout stroke Tin } bind def
  411.  
  412.     /Tout { 300 2 sqrt 1 sub mul
  413.         8 { dup 300 exch dup -90 135 arc 45 rotate } repeat
  414.         pop 50 setlinewidth } bind def
  415.     /Tin {  drawingB { 270 } { 300 } ifelse
  416.         8 { dup 0 0 moveto 0 lineto 45 rotate } repeat
  417.         pop stroke } bind def
  418.  
  419.     % Chameleon
  420.     /WC {    setpce Cout dohalo setW dofill setB stroke } bind def
  421.     /BC {    setpce Cout dohalo dofill stroke } bind def
  422.     /Cfig { setfig Cout stroke } bind def
  423.  
  424.     /Cout { 2 setmiterlimit 50 setlinewidth
  425.         -250 -350 moveto 500 0 rlineto -500 700 rlineto
  426.         500 0 rlineto closepath } bind def
  427.  
  428.     % Blob [for marking squares], also for Imitator
  429.     /blob { setpce 0 0 250 0 360 arc dohalo dofill } bind def
  430.     /blobfig { setfig 0 200 250 0 360 arc dofill } bind def
  431.  
  432. % Draughts/Dame/Checkers pieces
  433.  
  434.     % Man
  435.     /WD {    setpce Dout dohalo setW dofill setB stroke Din } bind def
  436.     /BD {    setpce Dout dohalo dofill stroke setW Din } bind def
  437.     /Dfig { setfig Dout stroke Din } bind def
  438.  
  439.     /Dout { 1 0.5 scale 0 0 350 0 180 arc 0 -400 350 180 0 arc
  440.         closepath 50 setlinewidth } bind def
  441.     /Din {  0 0 350 drawingB { 180 0 } { 210 -30 20 setlinewidth }
  442.         ifelse arc stroke 20 setlinewidth 0 0 220 0 360 arc stroke
  443.         0 0 80 0 360 arc stroke } bind def
  444.  
  445.     % King.  The mnemonic for this is unknown.
  446.     /WX {    setpce Xout dohalo setW dofill setB stroke Xin } bind def
  447.     /BX {    setpce Xout dohalo dofill stroke setW Xin } bind def
  448.     /Xfig { setfig Xout stroke Xin } bind def
  449.  
  450.     /Xout { 1 0.5 scale 0 400 350 0 180 arc 0 -400 350 180 0 arc
  451.         closepath 50 setlinewidth } bind def
  452.     /Xin {  0 400 350 drawingB { 180 0 } { 210 -30 20 setlinewidth }
  453.         ifelse arc stroke 0 0 350 drawingB { 180 0 } { 210 -30 }
  454.         ifelse arc stroke 20 setlinewidth 0 400 220 0 360 arc stroke
  455.         0 400 80 0 360 arc stroke } bind def
  456.  
  457. % Board symbols
  458.  
  459.     /Wsquare { 1 0 motion } bind def
  460.     /Bsquare { setpce (j) Tofig 90 Show } bind def
  461.     /Bsquarefig { 1000 0 0 0 1000 1000 setcachedevice
  462.         /xpix 62.5 dup dtransform /ypix exch def def
  463.         /xpabs xpix abs def /ypabs ypix abs def
  464.         xpabs ypabs lt {
  465.             ypabs ceiling dup 4 lt { pop 4 } if
  466.             dup ypix div xpix mul exch } {
  467.             xpabs ceiling dup 4 lt { pop 4 } if
  468.             dup xpix div ypix mul } ifelse
  469.         idtransform pop abs dup 3 div setlinewidth dup 2 mul 2000
  470.         { dup 1000 lt { dup 0 moveto 0 exch lineto }
  471.             { 1000 sub dup 1000 moveto 1000 exch lineto }
  472.             ifelse } for stroke } bind def
  473.     /board { 10000 0 800 0 9200 8400 setcachedevice
  474. %        Setfont intext /intext dup true def 1000 8200 moveto
  475. %        4 { (hhhhhhhhn) show currentpoint translate -90 rotate } repeat
  476. %        -90 rotate 0 7000 moveto
  477. %    The above was the intention, but the borders sometimes fail to match
  478. %    up by a pixel or two.  Hence the following!  However, the borders
  479. %    work perfectly well for special purposes.
  480.         Setfont intext /intext dup true def
  481.         20 setlinewidth 940 140 moveto 8120 0 Rlineto 0 8120 Rlineto
  482.         -8120 0 Rlineto closepath stroke
  483.         80 setlinewidth 840 40 moveto 8320 0 Rlineto 0 8320 Rlineto
  484.         -8320 0 Rlineto closepath stroke
  485.         2000 200 moveto 90 rotate
  486.         4 { (j j j j ; j j j j;) show } repeat exch def } bind def
  487.     /nextline { -8 -1 motion } bind def
  488.     /edge { setpce (h) Tofig 0 Show } bind def
  489.     /edgefig { 1000 0 0 0 1000 200 setcachedevice
  490.         20 setlinewidth 0 60 moveto 1000 0 rlineto stroke
  491.         80 setlinewidth 0 160 moveto 1000 0 rlineto stroke } bind def
  492.     /corner { setpce (n) Tofig 0 Show } bind def
  493.     /cornerfig { 0 0 0 0 200 200 setcachedevice
  494.         20 setlinewidth 0 60 moveto 60 0 rlineto 0 -60 rlineto stroke
  495.         80 setlinewidth 0 160 moveto 160 0 rlineto 0 -160 rlineto
  496.         stroke } bind def
  497.     /posstart { -9 7.2 motion } bind def
  498.     /posfinish { 1 -0.2 motion } bind def
  499.     /m0 { 0.5 dup motion } bind def
  500.     /m2 { 2 0 motion } bind def
  501.     /m3 { 3 0 motion } bind def
  502.     /m4 { 4 0 motion } bind def
  503.     /m5 { 5 0 motion } bind def
  504.     /m6 { 6 0 motion } bind def
  505.     /m7 { 7 0 motion } bind def
  506.     /m8 { 8 0 motion } bind def
  507.     /m9 { 0 1 motion } bind def
  508.     /m-1 { -1 0 motion } bind def
  509.     /underbar { 1000 0 -40 -40 1040 40 setcachedevice 80 setlinewidth
  510.         1 setlinecap 0 0 moveto 1000 0 lineto stroke } bind def
  511.     /sidebar { 0 0 setcharwidth 80 setlinewidth
  512.         1 setlinecap 0 0 moveto 0 1000 lineto stroke } bind def
  513.     /wblock { 0 0 setcharwidth setW
  514.         200 200 moveto 600 0 rlineto 0 600 rlineto -600 0 rlineto
  515.         fill } bind def
  516.  
  517. % Informant symbols
  518.  
  519.     /plusequals { 1000 0 100 0 900 800 setcachedevice 20 setlinewidth
  520.         100 10 moveto 800 0 rlineto 0 140 Rmoveto -800 0 rlineto
  521.         0 300 Rmoveto 800 0 rlineto 500 150 moveto 0 650 rlineto
  522.         stroke } bind def
  523.  
  524.     /equalsplus { 1000 0 100 0 900 800 setcachedevice 20 setlinewidth
  525.         100 790 moveto 800 0 rlineto 0 -140 Rmoveto -800 0 rlineto
  526.         0 -300 Rmoveto 800 0 rlineto 500 0 moveto 0 650 rlineto
  527.         stroke } bind def
  528.  
  529.     /plusorminus { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  530.         100 15 moveto 800 0 rlineto 0 385 Rmoveto -800 0 rlineto
  531.         500 0 moveto 0 800 rlineto stroke } bind def
  532.  
  533.     /minusorplus { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  534.         100 785 moveto 800 0 rlineto 0 -385 Rmoveto -800 0 rlineto
  535.         500 0 moveto 0 800 rlineto stroke } bind def
  536.  
  537.     /plus { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  538.         100 400 moveto 800 0 rlineto 500 0 moveto 0 800 rlineto
  539.         stroke } bind def
  540.  
  541.     /minus { 1000 0 100 385 900 415 setcachedevice 30 setlinewidth
  542.         100 400 moveto 800 0 rlineto stroke } bind def
  543.  
  544.     /equal { 1000 0 100 300 800 180 Round
  545.         320 add exch 100 add exch setcachedevice 20 setlinewidth
  546.         100 310 moveto 800 0 rlineto 0 180 Rmoveto -800 0 rlineto
  547.         stroke } bind def
  548.  
  549.     /infinity { 1000 0 95 60 905 540 setcachedevice 40 setlinewidth
  550.         275 300 160 0 360 arc 660 300 225 -180 180 arc stroke
  551.         } bind def
  552.  
  553.     /infinityequals { 1000 0 95 10 905 750 setcachedevice 30 setlinewidth
  554.         275 250 160 0 360 arc 660 250 225 -180 180 arc
  555.         100 565 moveto 800 0 rlineto 0 180 Rmoveto -800 0 rlineto
  556.         stroke } bind def
  557.  
  558.     /circarrow {1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  559.         500 400 385 0 30 arcn -200 0 rmoveto 200 0 rlineto
  560.         0 200 rlineto stroke } bind def
  561.  
  562.     /circledot { 900 0 100 0 800 700 setcachedevice 20 setlinewidth
  563.         450 350 20 0 360 arc fill 450 350 340 0 360 arc stroke
  564.         } bind def
  565.  
  566.     /rightarrow { 1200 0 100 185 1115 615 setcachedevice 30 setlinewidth
  567.         100 400 moveto 1000 0 rlineto -200 -200 rmoveto 200 200 rlineto
  568.         -200 200 rlineto stroke } bind def
  569.  
  570.     /uparrow { 500 0 35 0 465 915 setcachedevice 30 setlinewidth
  571.         250 0 moveto 0 900 rlineto -200 -200 rmoveto 200 200 rlineto
  572.         200 -200 rlineto stroke } bind def
  573.  
  574.     /botharrow { 1200 0 100 70 1100 730 setcachedevice 20 setlinewidth
  575.         100 280 moveto 990 0 rlineto -200 -200 rmoveto 200 200 rlineto
  576.         -200 200 rlineto 1100 520 moveto -990 0 rlineto
  577.         200 -200 rmoveto -200 200 rlineto 200 200 rlineto
  578.         stroke } bind def
  579.  
  580.     /circlebolddot { 1000 0 100 0 900 800 setcachedevice 20 setlinewidth
  581.         500 400 50 0 360 arc fill 500 400 390 0 360 arc stroke
  582.         } bind def
  583.  
  584.     /hash { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  585.         100 280 moveto 800 0 rlineto 0 240 Rmoveto -800 0 rlineto
  586.         380 0 moveto 0 800 rlineto 240 0 Rmoveto 0 -800 rlineto
  587.         stroke } bind def
  588.  
  589.     /triangle { 900 0 100 0 800 750 setcachedevice 30 setlinewidth
  590.         100 15 moveto 350 735 rlineto 350 -735 rlineto
  591.         closepath stroke } bind def
  592.  
  593.     /square { 900 0 100 0 680 680 Round
  594.         20 add exch 120 add exch setcachedevice 20 setlinewidth
  595.         110 10 moveto 680 0 Rlineto 0 680 Rlineto
  596.         -680 0 Rlineto closepath stroke } bind def
  597.  
  598.     /semicircle { 1000 0 50 0 950 465 setcachedevice 30 setlinewidth
  599.         500 15 435 0 180 arc closepath stroke } bind def
  600.  
  601.     /line { 1000 0 100 190 900 610 setcachedevice 20 setlinewidth
  602.         220 300 moveto 560 0 rlineto 0 200 Rmoveto -560 0 rlineto
  603.         310 200 moveto -200 200 rlineto 200 200 rlineto
  604.         690 200 moveto 200 200 rlineto -200 200 rlineto
  605.         stroke } bind def
  606.  
  607.     /diags { 1000 0 100 0 900 800 setcachedevice 20 setlinewidth
  608.         110 120 moveto 670 dup rlineto 110 -110 Rmoveto
  609.         -670 dup rlineto 640 790 moveto 250 0 rlineto
  610.         0 -250 rlineto stroke } bind def
  611.  
  612.     /centre { 1000 0 100 0 780 780 Round
  613.         20 add exch 120 add exch setcachedevice 20 setlinewidth
  614.         110 10 moveto 780 0 Rlineto 0 780 Rlineto -780 0 Rlineto
  615.         closepath 110 400 moveto 780 0 rlineto 500 10 moveto
  616.         0 780 Rlineto stroke } bind def
  617.  
  618.     /kside { 700 0 100 0 600 800 setcachedevice 20 setlinewidth
  619.         110 10 moveto 300 390 rlineto -300 390 rlineto
  620.         180 0 Rmoveto 300 -390 rlineto -300 -390 rlineto
  621.         stroke } bind def
  622.  
  623.     /qside { 700 0 100 0 600 800 setcachedevice 20 setlinewidth
  624.         590 10 moveto -300 390 rlineto 300 390 rlineto
  625.         -180 0 Rmoveto -300 -390 rlineto 300 -390 rlineto
  626.         stroke } bind def
  627.  
  628.     /weakpt { 700 0 100 0 600 500 setcachedevice 30 setlinewidth
  629.         110 10 moveto 480 480 rlineto 590 10 moveto -480 480 rlineto
  630.         stroke } bind def
  631.  
  632.     /ending { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  633.         100 15 moveto 800 0 rlineto 500 0 moveto 0 800 rlineto
  634.         stroke } bind def
  635.  
  636.     /bpair { 1200 0 100 0 980 580 Round
  637.         20 add exch 120 add exch setcachedevice 20 setlinewidth
  638.         110 10 moveto 570 0 Rlineto 0 370 Rlineto -570 0 Rlineto
  639.         closepath 110 10 moveto 980 580 Rmoveto -570 0 Rlineto
  640.         0 -370 Rlineto 570 0 Rlineto closepath stroke } bind def
  641.  
  642.     /oppbs { 1200 0 100 0 1100 600 setcachedevice 20 setlinewidth
  643.         110 10 moveto 570 0 Rlineto 0 370 Rlineto -570 0 Rlineto
  644.         closepath stroke 1100 600 moveto -590 0 rlineto
  645.         0 -390 rlineto 590 0 rlineto fill } bind def
  646.  
  647.     /samebs { 1200 0 100 0 1100 600 setcachedevice
  648.         100 0 moveto 590 0 rlineto 0 390 rlineto -590 0 rlineto
  649.         closepath 1100 600 moveto -590 0 rlineto 0 -390 rlineto
  650.         590 0 rlineto fill } bind def
  651.  
  652.     /united { 1210 0 50 0 1160 530 setcachedevice 30 setlinewidth
  653.         315 265 250 0 360 arc stroke 895 265 250 0 360 arc
  654.         stroke } bind def
  655.  
  656.     /separated { 1550 0 50 0 1500 530 setcachedevice 30 setlinewidth
  657.         315 265 250 0 360 arc stroke 1235 265 250 0 360 arc stroke
  658.         665 30 60 0 360 arc fill 885 30 60 0 360 arc fill } bind def
  659.  
  660.     /doubled { 730 0 100 0 630 1160 setcachedevice 30 setlinewidth
  661.         365 265 250 0 360 arc stroke 365 895 250 0 360 arc
  662.         stroke } bind def
  663.  
  664.     /tempo { 1000 0 100 0 900 800 setcachedevice 20 setlinewidth
  665.         110 400 moveto 500 400 390 0 360 arc 500 10 moveto
  666.         0 790 rlineto stroke } bind def
  667.  
  668.     /with { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  669.         100 800 moveto 0 -785 rlineto 785 0 rlineto stroke } bind def
  670.  
  671.     /without { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  672.         100 15 moveto 785 0 rlineto 0 785 rlineto stroke } bind def
  673.  
  674.     /etc { 500 0 100 0 270 800 Round
  675.         exch 130 add exch setcachedevice 30 setlinewidth
  676.         115 0 moveto 0 800 rlineto 270 0 Rmoveto 0 -800 rlineto
  677.         stroke } bind def
  678. end def
  679.  
  680. /BuildChar { exch begin CharProcs begin
  681.     { SetChar } stopped not { DoChar } if
  682.     end end } bind def
  683. end def
  684.  
  685. /ChessFont Cfont definefont pop
  686. % Demo file to be appended to the Chess Font file & sent to your LaserWriter
  687. %    (or whatever else you do with PostScript!).
  688.  
  689. % Miscellaneous useful procedures:
  690.  
  691.     % show string centred on the current point
  692. /cshow { dup stringwidth -2 div exch -2 div exch rmoveto show } bind def
  693.  
  694.     % Draw rank and file labels round a standard diagram
  695.     %   On entry, the ChessFont must be currently selected,
  696.     %   and the (properly scaled) font desired for the labels
  697.     %   must be top of stack.  Uses "cshow", defined above
  698. /dolabels {
  699.     ('[<0) show            % position of top-left label
  700.     (0) stringwidth -1.5 div    % 1/3-square offset
  701.     0 exch rmoveto exch        % restore labelfont to top of stack
  702.     [(8)(7)(6)(5)(4)(3)(2)(1)]    % rank labels
  703.     { gsave exch            % stack == offset, label, labelfont
  704.         dup setfont exch cshow
  705.       grestore
  706.       (8;) show            % move down a rank
  707.     } forall
  708.     [(a)(b)(c)(d)(e)(f)(g)(h)]    % file labels
  709.     { (>) show            % move along a file
  710.       gsave exch            % as before
  711.         dup setfont exch cshow
  712.       grestore
  713.     } forall pop            % zap the labelfont
  714.     (0]') show            % move to RHS of board
  715.     1.5 div 0 exch rmoveto        % undo previous offset
  716. } bind def
  717.  
  718.     % Rotate a piece.  The piece [eg "(Q)"] and the desired rotation
  719.     %   (in degrees, anticlockwise) should be on the stack
  720. /twirl {
  721.     gsave            % keep graphics state
  722.         (0) show    % go to centre of square
  723.         rotate        % no of degrees was on stack
  724.         (07;) show    % back to bottom left of rotated square --
  725.                 % "0" takes us from centre to top right, "7"
  726.                 % advances 7 squares, ";" goes down one and
  727.                 % back 8
  728.         show        % string was on stack
  729.     grestore        % restore graphics state
  730.     ( ) show        % advance to next square
  731. } bind def
  732.  
  733.     % Draw a neutral piece (for Fairy chess).  Expects two strings
  734.     %   [eg. "(R) (r)"] on the stack;  the first will be drawn in
  735.     %   the left half of the square, the second in the right half.
  736. /neutral {
  737.     2 dict begin            % small dictionary for xinc, yinc
  738.     gsave                % keep graphics state
  739.         (0) stringwidth        % distance to centre of square
  740.         /yinc exch 2 mul def
  741.         /xinc exch def
  742.         currentpoint
  743.         xinc 0 rlineto        % draw clipping rectangle round
  744.         0 yinc rlineto        % left half of square
  745.         xinc neg 0 rlineto clip
  746.         moveto show        % show left half-piece
  747.     grestore gsave            % cancel clip
  748.         currentpoint
  749.         xinc 0 rmoveto
  750.         xinc 0 rlineto        % clip right half of square
  751.         0 yinc rlineto
  752.         xinc neg 0 rlineto clip
  753.         moveto show        % show right half-piece
  754.     grestore            % restore graphics state
  755.     ( ) show            % advance to next square
  756.     end                % close small dictionary
  757. } bind def
  758.  
  759. % End of generally useful procedures.
  760.  
  761. % Quick hack definitions for this file:
  762.  
  763. % Miscellaneous definitions:
  764.  
  765. /ps 10.5 def        % point size
  766. /vs 12.5 def        % vertical spacing
  767. /V 11 72 mul def    % top margin
  768. /L 40 def        % left margin
  769.  
  770. /N { L V vs sub dup /V exch def moveto } bind def    % newline
  771. /T { currentpoint exch L sub 6 add 36 div ceiling 36 mul L add exch moveto }
  772.     bind def    % tab
  773.  
  774.     % Switch into Chess/Times/Courier/Bold
  775. /C { /ChessFont findfont ps scalefont setfont } bind def
  776. /R { /Times-Roman findfont ps scalefont setfont } bind def
  777. /H { /Courier findfont ps scalefont setfont } bind def
  778. /B { /Times-Bold findfont ps 1.25 mul scalefont setfont } bind def
  779.  
  780.     12345        % pseudo-random item on stack, as check
  781.